﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DOTNET101_namespaces
{
    namespace SampleNamespace
    {
        class SampleClass
        {
            public void SampleMethod()
            {
                System.Console.WriteLine(
                  "SampleMethod inside SampleNamespace");
            }
        }

        // Create a nested namespace, and define another class.
        namespace NestedNamespace
        {
            class SampleClass
            {
                public void SampleMethod()
                {
                    System.Console.WriteLine(
                      "SampleMethod inside NestedNamespace");
                }
            }
        }

        class Program
        {
            static void Main(string[] args)
            {
                // Displays "SampleMethod inside SampleNamespace."
                SampleClass outer = new SampleClass();
                outer.SampleMethod();

                // Displays "SampleMethod inside SampleNamespace."
                SampleNamespace.SampleClass outer2 = new SampleNamespace.SampleClass();
                outer2.SampleMethod();

                // Displays "SampleMethod inside NestedNamespace."
                NestedNamespace.SampleClass inner = new NestedNamespace.SampleClass();
                inner.SampleMethod();
            }
        }
    }
}
